package org.example.scenicspot.persistence;
import org.apache.ibatis.annotations.*;

import org.example.scenicspot.domain.EmergencyRescuePerson;
import org.example.scenicspot.domain.EmergencyRescueVehicle;
import org.example.scenicspot.domain.Staff;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface emergencyRescueVehicleMapper {
    @Select("select * from emergencyrescuevehiclemsg")
    List<EmergencyRescueVehicle> selectAll();

    @Select("SELECT * FROM emergencyrescuevehiclemsg WHERE emergencyrescuevehiclemsg.LicensePlateNumber LIKE CONCAT('%', #{LicensePlateNumber}, '%')")
    List<EmergencyRescueVehicle> selectByLicensePlateNumber(@Param("LicensePlateNumber") String LicensePlateNumber);

    @Select("SELECT * FROM emergencyrescuevehiclemsg WHERE ScenicAreaID = #{ScenicAreaID}")
    List<EmergencyRescueVehicle> selectByScenicAreaID(int ScenicAreaID);

    @Delete("DELETE FROM emergencyrescuevehiclemsg WHERE emergencyrescuevehiclemsg.id = #{id}")
    int deleteById(@Param("id") int id);

    @Insert("INSERT INTO emergencyrescuevehiclemsg (id,LicensePlateNumber,VehicleType,Capacity,Status,ScenicAreaID) VALUES(#{id},#{LicensePlateNumber},#{VehicleType},#{Capacity},#{Status},#{ScenicAreaID})")
    int insert(int id, String LicensePlateNumber, String VehicleType, String Capacity, String Status, int ScenicAreaID);

    @Update("UPDATE emergencyrescuevehiclemsg SET LicensePlateNumber=#{LicensePlateNumber},VehicleType=#{VehicleType},Capacity=#{Capacity},Status=#{Status},ScenicAreaID=#{ScenicAreaID} WHERE id = #{id}")
    int update(int id, String LicensePlateNumber, String VehicleType, String Capacity, String Status, int ScenicAreaID);
}
